<?php

/**
 * Topic
 *
 * @property integer $id
 * @property \Carbon\Carbon $created_at
 * @property \Carbon\Carbon $updated_at
 * @property-read \Illuminate\Database\Eloquent\Collection|\Content[] $contents
 */
use Cviebrock\EloquentSluggable\SluggableInterface;
use Cviebrock\EloquentSluggable\SluggableTrait;

class Topic extends Elegant implements SluggableInterface {

    use SluggableTrait;

    protected $fillable = [];
    protected $rules = array();
    protected $sluggable = array(
        'build_from' => 'title',
        'save_to' => 'slug',
    );

    public function contents() {
        return $this->hasMany('Content');
    }

    public function seo() {
        return $this->morphMany('Seo', 'seoble');
    }

    public function category() {
        return $this->belongsTo('Category');
    }

}
